/**
 * 
 */
package com.da.landlord;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 配置表: 权限管理根节点模型. 如: 房间管理
 * @author Jebel Qin
 * @date 2015年6月15日
 * @since v1.0
 */

@Entity
@Table(name="da_authroot")
public class AuthRoot
{
	//模块ID
	private Integer id;
	
	//模块名称(页面显示会用)
	private String name;
	
	//模块包括的操作
	private List<AuthAction> actions;
	
	//是否选中 (仅作页面显示用，不保持到DB)
	private Boolean checked;

	public AuthRoot() {}
	
	public AuthRoot(String name)
	{
		this.name = name;
	}
	
	public AuthRoot(Integer id, String name)
	{
		super();
		this.id = id;
		this.name = name;
	}

	@Id
	@GeneratedValue
	public Integer getId()
	{
		return id;
	}

	public void setId(Integer id)
	{
		this.id = id;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	@OneToMany(cascade=CascadeType.ALL, mappedBy="root")
	public List<AuthAction> getActions()
	{
		return actions;
	}

	public void setActions(List<AuthAction> actions)
	{
		this.actions = actions;
	}
	
	@Transient
	public Boolean getChecked()
	{
		return checked;
	}

	public void setChecked(Boolean checked)
	{
		this.checked = checked;
	}
}
